<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<div onclick="test('apple')">按钮</div>
	<body>
		<script type="text/javascript">
			// 传入一个数值来判断
			function test(fruit) {
			  const redFruits = ['apple', 'strawberry', 'cherry', 'cranberries'];
			  if (redFruits.includes(fruit)) {
			    console.log('red');
			  }
			}
		</script>
	</body>
</html>
